<?php
/*
 * Squelette : dist/backend.html
 * Date :      Wed, 20 Sep 2006 11:46:15 GMT
 * Compile :   Thu, 21 Sep 2006 14:28:49 GMT (0.14s)
 * Boucles :   _auteurs, _auteursb, _podcast, _un_article, _a, _10recents, _b, _tres_recents
 */ 
//
// <BOUCLE auteurs>
//
function BOUCLE_auteurshtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {

	// REQUETE
	$result = spip_abstract_select(
		array("auteurs.id_auteur",
		"auteurs.nom"), # SELECT
		array("spip_auteurs_articles AS auteurs_articles1","spip_auteurs AS auteurs"), # FROM
		array("auteurs.id_auteur=auteurs_articles1.id_auteur",
		"(auteurs_articles1.id_article = '" . addslashes($Pile[$SP]['id_article']) . "')",
		"NOT(auteurs.statut='5poubelle')"), # WHERE
		'auteurs.id_auteur', # GROUP
		array(), # ORDER
		'', # LIMIT
		'', # sous
		'', # HAVING
		'auteurs', # table
		'_auteurs', # boucle
		''); # serveur
	$t0 = "";
	$SP++;

	// RESULTATS
	while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {

		$Cache['id_auteur'][$Pile[$SP]['id_auteur']] = 1; // invalideurs

		$t1 = interdire_scripts(texte_backend(typo($Pile[$SP]['nom'])));
		$t0 .= (($t1 && $t0) ? ', ' : '') . $t1;
	}

	@spip_abstract_free($result,'');
	return $t0;
}


//
// <BOUCLE auteurs>
//
function BOUCLE_auteursbhtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {

	// REQUETE
	$result = spip_abstract_select(
		array("auteurs.id_auteur",
		"auteurs.nom"), # SELECT
		array("spip_auteurs_articles AS auteurs_articles2","spip_auteurs AS auteurs"), # FROM
		array("auteurs.id_auteur=auteurs_articles2.id_auteur",
		"(auteurs_articles2.id_article = '" . addslashes($Pile[$SP]['id_article']) . "')",
		"NOT(auteurs.statut='5poubelle')"), # WHERE
		'auteurs.id_auteur', # GROUP
		array(), # ORDER
		'', # LIMIT
		'', # sous
		'', # HAVING
		'auteurs', # table
		'_auteursb', # boucle
		''); # serveur
	$t0 = "";
	$SP++;

	// RESULTATS
	while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {

		$Cache['id_auteur'][$Pile[$SP]['id_auteur']] = 1; // invalideurs

		$t1 = interdire_scripts(texte_backend(typo($Pile[$SP]['nom'])));
		$t0 .= (($t1 && $t0) ? ', ' : '') . $t1;
	}

	@spip_abstract_free($result,'');
	return $t0;
}


//
// <BOUCLE documents>
//
function BOUCLE_podcasthtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {

	// REQUETE
	$result = spip_abstract_select(
		array("documents.id_document",
		"documents.taille",
		"types_documents.mime_type AS mime_type"), # SELECT
		array("spip_documents_articles AS documents_articles3","spip_documents AS documents","spip_types_documents AS types_documents"), # FROM
		array("documents.id_document=documents_articles3.id_document",
		"(documents_articles3.id_article = '" . addslashes($Pile[$SP]['id_article']) . "')",
		"(documents.mode = '" . addslashes('document') . "')",
		"documents.id_type=types_documents.id_type",
		"(documents.taille > 0 OR documents.distant='oui')"), # WHERE
		'documents.id_document', # GROUP
		array(), # ORDER
		'', # LIMIT
		'', # sous
		'', # HAVING
		'documents', # table
		'_podcast', # boucle
		''); # serveur
	$t0 = "";
	$SP++;

	// RESULTATS
	while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {

		$Cache['id_document'][$Pile[$SP]['id_document']] = 1; // invalideurs

		$t0 .= ((($t1 = unique(url_absolue(htmlspecialchars(vider_url(generer_url_document($Pile[$SP]['id_document'])))))) ?
			('
			<enclosure url="' . $t1 . ('" length="' .
interdire_scripts($Pile[$SP]['taille']) .
'" type="' .
interdire_scripts($Pile[$SP]['mime_type']) .
'" />')) :
			('')) .
'
		');
	}

	@spip_abstract_free($result,'');
	return $t0;
}


//
// <BOUCLE articles>
//
function BOUCLE_un_articlehtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
	$old_lang = $GLOBALS['spip_lang'];

	// REQUETE
	$result = spip_abstract_select(
		array("articles.id_article",
		"articles.titre",
		"articles.date",
		"articles.texte",
		"articles.chapo",
		"articles.descriptif",
		"articles.lang"), # SELECT
		array("spip_articles AS articles"), # FROM
		array("(articles.id_article = '" . addslashes($Pile[$SP]['id_article']) . "')",
		"articles.statut='publie'"), # WHERE
		'', # GROUP
		array(), # ORDER
		'', # LIMIT
		'', # sous
		'', # HAVING
		'articles', # table
		'_un_article', # boucle
		''); # serveur
	$t0 = "";
	$SP++;

	// RESULTATS
	while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {

		$Cache['id_article'][$Pile[$SP]['id_article']] = 1; // invalideurs
		if (!$GLOBALS['forcer_lang'])
	 		$GLOBALS['spip_lang'] = ($x = $Pile[$SP]['lang']) ? $x : $old_lang;
		$t0 .= ('
		<item>
		<title>' .
interdire_scripts(texte_backend(supprimer_numero(typo($Pile[$SP]['titre'])))) .
'</title>
		<link>' .
interdire_scripts(htmlspecialchars(vider_url(lire_meta('adresse_site')))) .
'/' .
htmlspecialchars(vider_url(generer_url_article($Pile[$SP]['id_article']))) .
'</link>
		<date>' .
vider_date($Pile[$SP]['date']) .
'</date>
		

' .
(($t1 = interdire_scripts($Pile[0]['rem'])) ?
			($t1 . '
	Il est possible de mettre le texte integral de l\'article dans le backend
	en remplacant *INTRODUCTION par *CHAPO et *TEXTE etc., a filtrer avec
	"liens_absolus".
') :
			('')) .
'

<description>' .
(($t1 = texte_backend(liens_absolus(affiche_logos(calcule_logo('ARTICLE', 'ON', $Pile[$SP]['id_article'],'',  '0'), '', 'right')))) ?
			($t1 . '
') :
			('')) .
interdire_scripts(texte_backend(calcul_introduction('articles', $Pile[$SP]['texte'], $Pile[$SP]['chapo'], $Pile[$SP]['descriptif']))) .
'</description>
		<author>' .
BOUCLE_auteurshtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'</author>
		<dc:date>' .
date_iso(vider_date($Pile[$SP]['date'])) .
'</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>' .
htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']) .
'</dc:language>
		<dc:creator>' .
BOUCLE_auteursbhtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'</dc:creator>
		' .
BOUCLE_podcasthtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'

		</item>
	');
	}

	$GLOBALS['spip_lang'] = $old_lang;
	@spip_abstract_free($result,'');
	return $t0;
}


//
// <BOUCLE boucle>
//
function BOUCLE_ahtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
	$t0 = BOUCLE_un_articlehtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP);
	return $t0;
}


//
// <BOUCLE articles>
//
function BOUCLE_10recentshtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
	$old_lang = $GLOBALS['spip_lang'];

	// REQUETE
	$result = spip_abstract_select(
		array("articles.id_article",
		"articles.lang"), # SELECT
		array("spip_articles AS articles"), # FROM
		array("".($Pile[$SP]['lang'] ? "(articles.lang = '" . $GLOBALS['spip_lang'] . "')" : 1)."",
		"".($Pile[$SP]['id_rubrique']? calcul_mysql_in('articles.id_rubrique',
		calcul_branche($Pile[$SP]['id_rubrique']), '') : 1)."",
		"" .calcul_mysql_in('articles.id_article', "0".$doublons[$doublons_index = ('articles' . '')], 'NOT') . "",
		"articles.statut='publie'"), # WHERE
		'', # GROUP
		array('articles.date' . ' DESC'), # ORDER
		'0,10', # LIMIT
		'', # sous
		'', # HAVING
		'articles', # table
		'_10recents', # boucle
		''); # serveur
	$t0 = "";
	$SP++;

	// RESULTATS
	while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {

		$Cache['id_article'][$Pile[$SP]['id_article']] = 1; // invalideurs
		$doublons[$doublons_index] .= ','. $Pile[$SP]['id_article']; // doublons
		if (!$GLOBALS['forcer_lang'])
	 		$GLOBALS['spip_lang'] = ($x = $Pile[$SP]['lang']) ? $x : $old_lang;
		$t0 .= ('
		' .
BOUCLE_ahtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'
	');
	}

	$GLOBALS['spip_lang'] = $old_lang;
	@spip_abstract_free($result,'');
	return $t0;
}


//
// <BOUCLE boucle>
//
function BOUCLE_bhtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
	$t0 = BOUCLE_un_articlehtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP);
	return $t0;
}


//
// <BOUCLE articles>
//
function BOUCLE_tres_recentshtml_5c759b9494210182833bdddba659202a(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {
	$old_lang = $GLOBALS['spip_lang'];

	// REQUETE
	$result = spip_abstract_select(
		array("articles.id_article",
		"articles.lang"), # SELECT
		array("spip_articles AS articles"), # FROM
		array("".($Pile[$SP]['lang'] ? "(articles.lang = '" . $GLOBALS['spip_lang'] . "')" : 1)."",
		"".($Pile[$SP]['id_rubrique']? calcul_mysql_in('articles.id_rubrique',
		calcul_branche($Pile[$SP]['id_rubrique']), '') : 1)."",
		"(LEAST((UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(articles.date))/86400,
	TO_DAYS(now())-TO_DAYS(articles.date),
	DAYOFMONTH(now())-DAYOFMONTH(articles.date)+30.4368*(MONTH(now())-MONTH(articles.date))+365.2422*(YEAR(now())-YEAR(articles.date))) < '" . addslashes('3') . "')",
		"" .calcul_mysql_in('articles.id_article', "0".$doublons[$doublons_index = ('articles' . '')], 'NOT') . "",
		"articles.statut='publie'"), # WHERE
		'', # GROUP
		array('articles.date' . ' DESC'), # ORDER
		'', # LIMIT
		'', # sous
		'', # HAVING
		'articles', # table
		'_tres_recents', # boucle
		''); # serveur
	$t0 = "";
	$SP++;

	// RESULTATS
	while ($Pile[$SP] = @spip_abstract_fetch($result,"")) {

		$Cache['id_article'][$Pile[$SP]['id_article']] = 1; // invalideurs
		$doublons[$doublons_index] .= ','. $Pile[$SP]['id_article']; // doublons
		if (!$GLOBALS['forcer_lang'])
	 		$GLOBALS['spip_lang'] = ($x = $Pile[$SP]['lang']) ? $x : $old_lang;
		$t0 .= ('
		' .
BOUCLE_bhtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'
	');
	}

	$GLOBALS['spip_lang'] = $old_lang;
	@spip_abstract_free($result,'');
	return $t0;
}



//
// Fonction principale du squelette dist/backend.html
//
function html_5c759b9494210182833bdddba659202a ($Cache, $Pile, $doublons=array(), $Numrows='', $SP=0) {
$t0 = ('<?php
	@header(\'Content-type: text/xml' .
(($t1 = interdire_scripts(lire_meta('charset'))) ?
			('; charset=' . $t1) :
			('')) .
'\');
	echo \'<\'.\'?xml version="1.0" encoding="' .
interdire_scripts(lire_meta('charset')) .
'"?\'.">\\n";
?>
<rss version="0.91" xmlns:dc="http://purl.org/dc/elements/1.1/">

<channel>
	<title>' .
interdire_scripts(texte_backend(typo(lire_meta('nom_site')))) .
'</title>
	<link>' .
interdire_scripts(htmlspecialchars(vider_url(lire_meta('adresse_site')))) .
'/</link>
	<description></description>
	<language>' .
htmlentities($Pile[0]['lang'] ? $Pile[0]['lang'] : $GLOBALS['spip_lang']) .
'</language>

	<image>
		<title>' .
interdire_scripts(texte_backend(typo(lire_meta('nom_site')))) .
'</title>
		<url>' .
texte_backend(url_absolue(extraire_attribut(affiche_logos(calcule_logo('RUBRIQUE', 'ON', "'0'",sql_parent("'0'"),  '0'), '', ''),'src'))) .
'</url>
		<link>' .
interdire_scripts(htmlspecialchars(vider_url(lire_meta('adresse_site')))) .
'/</link>
		<description></description>
	</image>

	' .
BOUCLE_un_articlehtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'


	' .
BOUCLE_10recentshtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'
	' .
BOUCLE_tres_recentshtml_5c759b9494210182833bdddba659202a($Cache, $Pile, $doublons, $Numrows, $SP) .
'

</channel>

</rss>
');

	return array(
		'texte' => $t0,
		'squelette' => 'html_5c759b9494210182833bdddba659202a',
		'process_ins' => ((strpos($t0,'<'.'?')=== false) ? 'html' : 'php'),
		'invalideurs' => $Cache
	);
}

?>